package com.weijin.controller;

import com.weijin.model.entities.ExceptionRecordInfo;
import com.weijin.model.vo.RestResultVo;
import com.weijin.service.IExceptionInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 异常打卡相关接口控制类
 *
 * @Author WeiJin
 * @Version 1.0
 * @Date 2025/3/28 14:09
 */
@RestController
@RequestMapping("/exceptionInfo")
@Api(tags = "异常打卡相关接口")
public class ExceptionInfoController {

    @Autowired
    private IExceptionInfoService exceptionInfoService;

    /**
     * 获取所有异常打卡记录
     *
     * @return 所有异常打卡记录
     */
    @GetMapping("/queryAllExceptionInfo")
    @ApiOperation("获取所有异常打卡记录")
    public RestResultVo<List<ExceptionRecordInfo>> queryAllExceptionInfo() {
        List<ExceptionRecordInfo> exceptionRecordInfos = exceptionInfoService.queryAllExceptionInfo();
        return RestResultVo.ok(exceptionRecordInfos);
    }


    /**
     * 根据用户id获取其所有异常打卡记录
     *
     * @param userId 用户id
     * @return 其所有异常打卡记录
     */
    @GetMapping("/queryUserExceptionInfo")
    @ApiOperation("根据用户id获取其所有异常打卡记录")
    public RestResultVo<List<ExceptionRecordInfo>> queryUserExceptionInfo(@RequestParam("userId") String userId) {
        List<ExceptionRecordInfo> exceptionRecordInfos = exceptionInfoService.queryUserExceptionInfo(userId);
        return RestResultVo.ok(exceptionRecordInfos);
    }
}
